package com.heima.behavior.controller.v1;

import com.heima.behavior.service.BehaviorService;
import com.heima.model.behavior.dtos.LikeBehaviorDto;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.behavior.dtos.UnlikesBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
public class BehaviorController {

    @Autowired
    private BehaviorService behaviorService;

    /**
     *用户点赞/取消点赞
     * @param dto
     * @return
     */
    @PostMapping("likes_behavior")
    public ResponseResult likesBehavior(@RequestBody LikeBehaviorDto dto){
        return behaviorService.likesBehavior(dto);
    }

    /**
     * 用户阅读
     * @param dto
     * @return
     */
    @PostMapping("read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto dto){
        return behaviorService.readBehavior(dto);
    }

    /**
     * 用户不喜欢/取消不喜欢
     * @param dto
     * @return
     */
    @PostMapping("un_likes_behavior")
    public ResponseResult unlikesBehavior(@RequestBody UnlikesBehaviorDto dto){
        return behaviorService.unlikesBehavior(dto);
    }

}
